﻿using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Data;
using BySoft.Server.Business;
using BySoft.Server.Common.Entity;
using BySoft.Server.Common.Enum;
using BySoft.Web.Utility;
using BySoft.Server.Consts;
using BySoft.Server.Common;
using BySoft.Web.Controls;

namespace BySoft.Web.Site.ComPage
{
    public partial class SetFormAudit : BasePopPage
    {
        #region 变量定义
        int m_count = 0;

        private DataTable CreateDT()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("AuditMan"); //明细ID
            dt.Columns.Add("AuditResults");       //部门
            dt.Columns.Add("AuditRemark");       //部门
            return dt;
        }

        protected DataTable DtDetail
        {
            get
            {
                if (Session["DtDetail"] != null)
                {
                    return (DataTable)Session["DtDetail"];
                }
                else
                {
                    return CreateDT();
                }
            }
            set
            {
                Session["DtDetail"] = value;
            }
        }
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DtDetail = null;
                sgvMember.Style.Add("word-break", "keep-all");
                sgvMember.Style.Add("word-wrap", "normal");
                BindData(0);
            }
        }

        void InitData()
        {


        }

        private void BindData(int pageIndex)
        {
            DataTable dtTemp = DtDetail.Clone();
            for (int i = 1; i < 6; i++)
            {

                DataRow drItem = dtTemp.NewRow();
                drItem["AuditRemark"] = "同意";
                drItem["AuditResults"] = "同意";
                drItem["AuditMan"] = "审核人" + i;
                dtTemp.Rows.Add(drItem);
                DtDetail = dtTemp.Copy();
            }
            DataTable dt = DtDetail.Copy();
            if (dt.Rows.Count > 0)
            {
                sgvMember.DataSource = dt;
                sgvMember.DataBind();
               
            }
            else
            {
                UIHelper.BindEmptyGridView(sgvMember, dt);

            } UIHelper.RunScript(this.Page, "iframeAutoFit();");
        }




        protected void btnOk_Click(object sender, EventArgs e)
        {
            

        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>CloseTopDialog();</script>");
        }

  

        
        #region Grid事件
        /// <summary>
        ///   行事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "del")
            {

            }
        }

        /// <summary>
        /// 行数据绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdResult_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
              
            }
        }

        #endregion

    }
}